package com.example.environment;

import com.example.base.BaseEntity;
import com.fasterxml.jackson.annotation.*;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author wangbin
 */
@Getter
@Setter
@Entity
@Table(name = "t_environment")
public class Environment extends BaseEntity implements Serializable {

    private static final long serialVersionUID = -1483374433172529416L;

    private String title;

    private String fromHost;
    private Integer fromPort;
    private String fromUsername;
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String fromPassword;

    private String toHost;
    private Integer toPort;
    private String toUsername;
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private String toPassword;

    @OneToMany(mappedBy = "environment", cascade = CascadeType.ALL, orphanRemoval = true)
    @JsonIgnoreProperties({"environment"})
    private List<EnvironmentDatabase> list = new ArrayList<>();

}
